package com.jay.io.clazz;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileStreamCls {
	public static void main(String[] args) throws IOException {
		File f = new File("out.txt");
		FileInputStream fis = new FileInputStream(f);

		byte[] b = new byte[(int) f.length() - 1];
		fis.skip(1);
		System.out.println("The current available size is " + fis.available());
		fis.read(b);

		for (int i = 0; i < b.length; i++) {
			System.out.println(b[i]);
		}

		String bb = new String(b);
		System.out.println(bb);
		boolean a = true;
		File ff = new File("out1.txt");
		FileOutputStream fos = new FileOutputStream(ff, a);
		fos.write(b);
		String abc = "abc";
		byte[] ab = abc.getBytes();
		fos.write(ab);
		System.out.println("***********************");
		System.out.println(fos.getChannel());
		System.out.println(fos.getFD());
		System.out.println(fis.getChannel());
		System.out.println(fis.getFD());
		fis.close();
		fos.close();

	}
}
